package com.ruoyi.service.service.impl;

import com.ruoyi.service.domain.ServiceMycart;
import com.ruoyi.service.mapper.ServiceMycartMapper;
import com.ruoyi.service.service.IServiceMycartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 购物车Service业务层处理
 * 
 * @author ZDL
 * @date 2024-12-20
 */
@Service
public class ServiceMycartServiceImpl implements IServiceMycartService 
{
    @Autowired
    private ServiceMycartMapper serviceMycartMapper;

    /**
     * 查询购物车
     * 
     * @param mycartId 购物车主键
     * @return 购物车
     */
    @Override
    public ServiceMycart selectServiceMycartByMycartId(Long mycartId)
    {
        return serviceMycartMapper.selectServiceMycartByMycartId(mycartId);
    }

    @Override
    public List<ServiceMycart> selectServiceMycartByMycartUserId(Long userId) {
        return serviceMycartMapper.selectServiceMycartByMycartUserId(userId);
    }

    /**
     * 查询购物车列表
     * 
     * @param serviceMycart 购物车
     * @return 购物车
     */
    @Override
    public List<ServiceMycart> selectServiceMycartList(ServiceMycart serviceMycart)
    {
        return serviceMycartMapper.selectServiceMycartList(serviceMycart);
    }

    /**
     * 新增购物车
     * 
     * @param serviceMycart 购物车
     * @return 结果
     */
    @Override
    public int insertServiceMycart(ServiceMycart serviceMycart)
    {
        return serviceMycartMapper.insertServiceMycart(serviceMycart);
    }

    /**
     * 修改购物车
     * 
     * @param serviceMycart 购物车
     * @return 结果
     */
    @Override
    public int updateServiceMycart(ServiceMycart serviceMycart)
    {
        return serviceMycartMapper.updateServiceMycart(serviceMycart);
    }

    /**
     * 批量删除购物车
     * 
     * @param mycartIds 需要删除的购物车主键
     * @return 结果
     */
    @Override
    public int deleteServiceMycartByMycartIds(Long[] mycartIds)
    {
        return serviceMycartMapper.deleteServiceMycartByMycartIds(mycartIds);
    }

    /**
     * 删除购物车信息
     * 
     * @param mycartId 购物车主键
     * @return 结果
     */
    @Override
    public int deleteServiceMycartByMycartId(Long mycartId)
    {
        return serviceMycartMapper.deleteServiceMycartByMycartId(mycartId);
    }
}
